// 设备类型枚举
export const DEVICE_TYPES = {
  LIGHT: 'light',
  AIR_CONDITIONER: 'air_conditioner',
  CURTAIN: 'curtain',
  CAMERA: 'camera'
}

// 设备状态枚举
export const DEVICE_STATUS = {
  ON: 'on',
  OFF: 'off'
}

// 设备基类
export class Device {
  constructor(id, name, type, room = '客厅') {
    this.id = id
    this.name = name
    this.type = type
    this.room = room
    this.status = DEVICE_STATUS.OFF
    this.createdAt = new Date()
  }
}

// 灯光设备
export class LightDevice extends Device {
  constructor(id, name, room = '客厅') {
    super(id, name, DEVICE_TYPES.LIGHT, room)
    this.brightness = 50 // 亮度 0-100
    this.color = '#ffffff' // 颜色
  }
}

// 空调设备
export class AirConditionerDevice extends Device {
  constructor(id, name, room = '客厅') {
    super(id, name, DEVICE_TYPES.AIR_CONDITIONER, room)
    this.temperature = 26 // 温度
    this.mode = 'cool' // 模式: cool, heat, fan, auto
    this.fanSpeed = 'medium' // 风速: low, medium, high
  }
}

// 窗帘设备
export class CurtainDevice extends Device {
  constructor(id, name, room = '客厅') {
    super(id, name, DEVICE_TYPES.CURTAIN, room)
    this.position = 0 // 位置 0-100 (0=完全关闭, 100=完全打开)
  }
}

// 摄像头设备
export class CameraDevice extends Device {
  constructor(id, name, room = '客厅') {
    super(id, name, DEVICE_TYPES.CAMERA, room)
    this.recording = false // 是否正在录像
    this.nightVision = false // 夜视模式
    this.resolution = '1080p' // 分辨率: 1080p, 720p, 480p
    this.pan = 0 // 水平角度 -180~180
    this.tilt = 0 // 垂直角度 -90~90
    this.streamUrl = '' // 视频流URL
  }
}

// 场景模式
export const SCENE_MODES = {
  HOME: 'home', // 在家模式
  AWAY: 'away', // 离家模式
  SLEEP: 'sleep', // 睡眠模式
  PARTY: 'party' // 聚会模式
}

// 场景模式配置
export const SCENE_CONFIGS = {
  [SCENE_MODES.HOME]: {
    name: '在家模式',
    description: '正常生活模式',
    icon: 'House'
  },
  [SCENE_MODES.AWAY]: {
    name: '离家模式', 
    description: '关闭所有设备，节能模式',
    icon: 'Location'
  },
  [SCENE_MODES.SLEEP]: {
    name: '睡眠模式',
    description: '关闭灯光，调节空调温度',
    icon: 'Moon'
  },
  [SCENE_MODES.PARTY]: {
    name: '聚会模式',
    description: '开启所有灯光，调节空调',
    icon: 'Star'
  }
}
